package data.promotion;

import java.util.Calendar;

import data.SaleRecord;

public class SaleDiscountRecord {
	
	private double discount_price;
	
	private double discount;
	
	private Calendar start_time;
	
	private Calendar end_time;
	
	
	public SaleDiscountRecord(){
		
	}
	
	public SaleDiscountRecord(double discount_price,double discount,Calendar start_time,Calendar end_time){
		this.set(discount_price, discount, start_time, end_time);
	}
	
	
	public void set(double discount_price,double discount,Calendar start_time,Calendar end_time){
		this.discount_price=discount_price;
		this.discount=discount;
		this.start_time=start_time;
		this.end_time=end_time;
	}
	
	
	public void setSale(SaleRecord saleRecord){
		double sale_price=saleRecord.getTotalPrice();
		if(sale_price>=discount_price){
			discount_price=sale_price*discount;
			saleRecord.setSpecialPrice(discount_price);
		}
	}
}
